Thank you Eskimo for the detail explanation, that helps a lot. And and @Sendable closure solution solved my issue.
And I want to mention something related. I'm using the async version before, just like the one you mention before:
[quote='806202022, DTS Engineer, /thread/764777?answerId=806202022#806202022']
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
Task {
do {
_ = try await UNUserNotificationCenter.current().requestAuthorization(options: authOptions)
print("here")
} catch {
print("there")
}
}
[/quote]
But recently I detect a memory leak in the Instruments, that's why I need to find a way to go back to the completion callback version. Could you find out why the async version has that memory leak? BTW I'm using Xcode 16.1.0. And here is the screenshot in Instruments:
Your can easily reproduce it in Instruments with the code you provide.
Post
Replies
Boosts
Views
Activity
I find a way to solve the issue and wrote an article about this. https://medium.com/@GalvinLi/fix-the-table-header-gap-in-ios-15-197debb92608
In short way:
Just set a tableHeaderView before table loaded.
- (void)viewDidLoad {
[super viewDidLoad];
self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];
}
or change it globally
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[UITableView appearance].tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];
return YES;
}